<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>分店密码修改</title>
<%@include file="../collect/meta.jsp"%>
<script src="${ctx}/js/md5.js"></script>
<script type="text/javascript" src="${ctx}/js/returnTop.js"></script>
<style type="text/css">
.tbinput {
	width: 180px;
	height: 25px;
	font-size: 14px;
	background-color: #FFFFCC;
}
</style>
<link rel="stylesheet" href="css/radius.css" type="text/css"></link>
<link rel="stylesheet" href="css/Inputstyle.css" type="text/css"></link>
<link rel="stylesheet" href="css/muser_password.css" type="text/css"></link>
</head>
<body lang="zh-cn">
	<div class="wrapper">
		<c:import url="/collect/top.jsp"></c:import>
		<div class="main-container" id="main-container">
			<div class="main-container-inner">
				<c:import url="/collect/left.jsp"></c:import>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<ul class="breadcrumb">
							<li><i class="icon-home home-icon"></i>密码管理</li>
							<li><a href="muser!getAllUser1">分店密码管理</a>
							</li>
							<li>密码修改</li>
						</ul>
					</div>
					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<form action="muser!updateUser" name="updateuser" method="post">
									<div align="center">
										<div class="loginID">
											<label for="">登陆账号: &nbsp;${user.mobile }</label> 
										</div>
										<div class="newpassword">
											<label for="userPassword1">新密码:&nbsp;</label> <input
												type="password" name="userpassword" id="userPassword1" />
										</div>
										<div class="again">
											<label for="userPassword2">请再次输入:&nbsp;</label> <input
												type="password" id="userPassword2" /><label id="p2label"></label>
										</div>
										<input type="hidden" name="user.id" value="${user.id }"
											id="userId" />
										<div id="btn-team">
											<input type="button" class="btn btn-primary radius"
												id="pButton" value="修改">
										</div>
										<input type="hidden" name="user.createTime" value="${user.createTime }" />
									</div>
								</form>
								<!-- PAGE CONTENT ENDS -->
							</div>
							<!-- /.col -->
						</div>
						<!-- /.row -->
					</div>
					<!-- /.page-content -->
				</div>
				<!-- /.main-content -->
			</div>
			<!-- /.main-container-inner -->
			<a href="#" id="btn-scroll-up"
				class="btn-scroll-up btn btn-sm btn-inverse"
				style="position: fixed; bottom: 0;"> <i
				class="icon-double-angle-up icon-only bigger-110"></i> </a>
		</div>
		<!-- /.main-container -->
		<div class="push"></div>
	</div>
	<c:import url="/collect/down.jsp"></c:import>

	<script type="text/javascript">
		$(function() {
			$('#accountPassword2').blur(function() {
				var p2 = $('#userPassword2').val();
				var p1 = $('#userPassword1').val();
				if (p1 != p2) {
					alert('两次密码输入不一致');
				}
			});

		});

		$('#pButton').click(function() {
			var p2 = $('#userPassword2').val();
			var p1 = $('#userPassword1').val();
			if (p1.length != 0) {
				if (p1 != p2) {
					alert('两次密码输入不一致');
				} else {

					var password = $('#userPassword1').val();
					var userId = $('#userId').val();
					$.ajax({
						async : false,
						url : "muser!updatePasswordByAccount",
						type : "post",
						data : {
							"userpassword" : faultylabs.MD5(password),
							"userId" : userId
						},
						datatype : "json",
						success : function(data) {
							var d = eval("(" + data + ")");
							alert(d.temp);
							window.location.href = 'muser!getAllUser1';

						},
						error : function(request) {
							alert("Connection error");
						}
					});
				}
			} else {
				alert('密码不能为空');
			}
		});
		$(document).ready(function() {
			$('.fendianguanli > ul').show();
			$('.fendianguanli > ul > li > a').eq(2).css("color", "red");
		});
	</script>
</body>
</html>